Midrash su I Re 9:4
וְאַתָּ֞ה אִם־תֵּלֵ֣ךְ לְפָנַ֗י כַּאֲשֶׁ֨ר הָלַ֜ךְ דָּוִ֤ד אָבִ֙יךָ֙ בְּתָם־לֵבָ֣ב וּבְיֹ֔שֶׁר לַעֲשׂ֕וֹת כְּכֹ֖ל אֲשֶׁ֣ר צִוִּיתִ֑יךָ חֻקַּ֥י וּמִשְׁפָּטַ֖י תִּשְׁמֹֽר׃
E quanto a te, se tu camminerai davanti a Me, come Davide tuo padre camminò, nell'integrità del cuore e nella rettitudine, per fare secondo tutto ciò che ti ho comandato, e osserverai i miei statuti e le mie ordinanze;
Sifrei Devarim
R. Chanina b. Gamliel says: It is written (I Kings 3:13) "And also what you (Solomon) did not ask I have granted you — even riches and honor": I have granted you even what is not stipulated in the Torah. Shall I not then grant you what is written in the Torah (i.e., length of days, etc.) Only on condition that you observe the Torah, viz. (Ibid. 14) "If you (Solomon) walk in My ways to keep My statutes and My mitzvoth, as did your father David, then I shall prolong your days," and (Ibid. 9:4) "And as for you, if you walk before Me as your father David did, with wholeheartedness and uprightness, to do according to all that I have commanded you, to keep My statutes and My judgments, etc."
Ask RabbiBookmarkShareCopy